#include <WinSock2.h>
#include <stdio.h>

int main()
{
	WORD wVersionRequested;
	WSADATA wsaDAta;
	int err;

	wVersionRequested = MAKEWORD(1, 1);

	err = WSAStartup(wVersionRequested, &wsaDAta);
	if(err != 0)
		return 1;

	if(LOBYTE(wsaDAta.wVersion) != 1 || HIBYTE(wsaDAta.wVersion) != 1)
	{
		WSACleanup();
		return 1;
	}
	SOCKET sockClient = socket(AF_INET, SOCK_STREAM, 0);

	SOCKADDR_IN addrSvr;
	addrSvr.sin_addr.S_un.S_addr = inet_addr("127.0.0.1");
	addrSvr.sin_family = AF_INET;
	addrSvr.sin_port = htons(6000);

	connect(sockClient, (SOCKADDR*)&addrSvr, sizeof(SOCKADDR));

	char recvBuf[100];

	recv(sockClient, recvBuf, 100, 0);
	printf("%s\n", recvBuf);

	send(sockClient, "This is lisi", strlen("This is lisi")+1,0);

	closesocket(sockClient);
	WSACleanup();
	system("pause");
    return 0;
}